package com.ss.android.video;

import android.view.SurfaceHolder;

import java.lang.ref.WeakReference;

public final class WeakSurfaceHolderCallbackWrapper implements SurfaceHolder.Callback {
    public WeakReference<SurfaceHolder.Callback> refCallback;

    public WeakSurfaceHolderCallbackWrapper(SurfaceHolder.Callback callback) {
        this.refCallback = new WeakReference(callback);
    }

    public final void surfaceChanged(SurfaceHolder surfaceHolder, int arg3, int arg4, int arg5) {
        SurfaceHolder.Callback callback = this.refCallback.get();
        if (callback != null) {
            callback.surfaceChanged(surfaceHolder, arg3, arg4, arg5);
        }
    }

    public final void surfaceCreated(SurfaceHolder surfaceHolder) {
        SurfaceHolder.Callback callback = this.refCallback.get();
        if (callback != null) {
            callback.surfaceCreated(surfaceHolder);
        }
    }

    public final void surfaceDestroyed(SurfaceHolder surfaceHolder) {
        SurfaceHolder.Callback callback = this.refCallback.get();
        if (callback != null) {
            callback.surfaceDestroyed(surfaceHolder);
        }
    }
}

